[GLOBAL detect_cpu_speed]

[EXTERN timer_wait]
 
detect_cpu_speed:     
 
   rdtsc
 
   push edx
   push eax
 
   push 1000
   call timer_wait
 
   rdtsc   
 
   sub  eax, [esp]
   sbb  edx, [esp + 4]
 
   add  esp, 08h
 
   mov  ecx, 1000000
   div  ecx
 
   pop eax
 
ret